var Adv_skd=require("./Adv_skd2")

cc.Class({
  extends: cc.Component,
  properties: {
    addCount: 30,
    countTipNode: cc.Node,
    countLabel: cc.Label
  },
  initBy: function (t) {
        Adv_skd.default.instance.hideAllAdv();
    
        Adv_skd.default.instance.showInterstitialAd();
        Adv_skd.default.instance.showGridAdTop();
        Adv_skd.default.instance.showBannerAd();
    cc.pvz.TAUtils.trackAdUIShow(cc.pvz.GameConfig.AdType.阳光);
    this.countTipNode.active = 2 == cc.pvz.runtimeData.mode;
    this.countTipNode.active && (this.countLabel.string = cc.pvz.runtimeData.buyCoinCount);
    this.cb = t;
  },
  onClickClose: function () {
        Adv_skd.default.instance.hideAllAdv();
    
    cc.popupManager.removePopup(this);
  },
  onClickAd: function () {
    var t = this;
    cc.pvz.AdUtils.showAdRewardVideo(cc.pvz.GameConfig.AdType.阳光, function (e) {
      if (e) {
        2 == cc.pvz.runtimeData.mode && cc.pvz.runtimeData.buyCoinCount--;
        cc.pvz.runtimeData.addMoney(t.addCount);
        t.cb && t.cb();
        cc.popupManager.removePopup(t);
      }
    });
  }
});